/* ============================================================================================
Abstract Data Type(ADT) is placed under the MIT license
Copyright (c) 2013 Ted Lin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sub-license, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================================================================*/

/* Define to prevent recursive inclusion*/
#ifndef _CLIST_H
#define _CLIST_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes */
#include <stdlib.h>
#include <assert.h>

typedef struct CList_tag CList;
typedef struct CListElmt_tag CListElmt;

extern CList* clist_create(void (*destroy)(void* data));
extern void clist_destroy(CList* list);
extern int clist_ins_next(CList* list, \
				   CListElmt* element, const void* data);
extern int clist_rmv_next(CList* list, \
				   CListElmt* element, void** data);

extern int clist_size(const CList* list);
extern CListElmt* clist_head(const CList* list);
extern int clist_is_head(const CList* list,\
				  const CListElmt* element);

extern void* clist_data(const CListElmt* element);
extern CListElmt* clist_next(const CListElmt* element);

#ifdef __cplusplus
}
#endif

#endif/* __CLIST_H */
/******************* (C) COPYRIGHT 2013 Ted Lin *****END OF FILE****/